package com.example.mapper;

import com.example.pojo.Apartment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ApartmentMapper {

    @Insert("insert into apartment(name, location, fitment, area, room_type, price, towards, host_information, number,subway,id_u, image) values(#{name},#{location},#{fitment},#{area},#{roomType},#{price},#{towards},#{hostInformation},#{number},#{subway},#{idU},#{image})")
    void add(Apartment apartment);

    List<Apartment> getApartment(String name,Integer cuType, Integer idU);

    @Delete("delete from apartment where id=#{id} and id_u=#{idU}")
    void delApartment(Integer id, Integer idU);

    @Select("select * from apartment where id=#{id}")
    Apartment getApartmentId(Integer id);

    void setApartment(Apartment apartment);

    List<Apartment> getApartmentIndex(String name, String location, String fitment, Double areaMin, Double areaMax, Double priceMin, Double priceMax, String roomType, String towards,String subway);

    @Update("update apartment set cu_type=0 where id=#{id}")
    void setApartmentCu(Integer id);

    void setCu(List<Integer> idAs);
}
